/* Binary Ninja C++ API Documentation Styles
 * Clean CSS implementation replacing Doxygen defaults
 * No !important declarations needed
 */

/* ============================================================================
 * CSS VARIABLES - LIGHT MODE (Base)
 * ============================================================================ */
:root {
    /* Binary Ninja Brand Colors */
    --bn-red: #c74433;
    --bn-red-dark: #d0584d;
    --bn-red-light: #a2382a;

    /* Complementary Colors (Teal - complementary to red) */
    --bn-teal: #33b6c7;
    --bn-teal-bright: #16b9ce;
    --bn-teal-light: #eaf8f9;
    --bn-teal-dark: #163f44;
    --bn-teal-accent: #36cee2;

    /* Page Structure */
    --page-bg: #ffffff;
    --page-text: #2f4153;
    --page-text-secondary: #6f7e8e;
    --border-color: #dedede;

    /* Sidebar */
    --sidebar-bg: #fbfbfb;
    --sidebar-text: #2f4153;

    /* Code/Fragments */
    --code-bg: #f5f5f5;
    --code-text: #2f4153;
    --fragment-bg: #F8F9FA;
    --fragment-text: #37474F;
    --fragment-border: #e3e5e7;

    /* Syntax Highlighting (Light) */
    --syntax-keyword: #bb6bb2;
    --syntax-type: #8258b3;
    --syntax-flow: #d67c3b;
    --syntax-string: #438a59;
    --syntax-comment: #969696;
    --syntax-preprocessor: #46aaa5;
    --syntax-link: #5383d6;

    /* Tables */
    --table-header-bg: #f1f1f1;
    --table-row-odd: #ffffff;
    --table-row-even: #f7f7f7;

    /* Content Boxes */
    --warning-bg: #faf3d8;
    --warning-border: #f3a600;
    --note-bg: var(--bn-teal-light);
    --note-border: var(--bn-teal-bright);
    --deprecated-bg: #ecf0f3;
    --deprecated-border: #5b6269;
    --bug-bg: #f8d1cc;
    --bug-border: #b61825;
    --todo-bg: #e4dafd;
    --todo-border: #5b2bdd;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
    --font-family-monospace: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
    --font-size-base: 15.6px;
    --font-size-code: 14px;
    --font-size-nav: 14.4px;
    --font-size-title: 22px;
    --line-height-content: 27px;

    /* Layout */
    --sidebar-width: 450px;
    --top-height: 120px;
    --content-maxwidth: 1050px;
    --spacing-small: 5px;
    --spacing-medium: 10px;
    --spacing-large: 16px;
    --spacing-xlarge: 20px;
    --border-radius-small: 5px;
    --border-radius-medium: 8px;
    --border-radius-large: 10px;
    --searchbar-height: 33px;
    --searchbar-border-radius: 33px;
    --tree-item-height: 30px;
}

/* ============================================================================
 * CSS VARIABLES - DARK MODE
 * ============================================================================ */
html.dark-mode {
    color-scheme: dark;

    /* Brand Colors (same) */
    --bn-red: #c74433;
    --bn-red-dark: #d0584d;
    --bn-red-light: #a2382a;

    /* Complementary Colors (Teal - same base) */
    --bn-teal: #33b6c7;
    --bn-teal-bright: #16b9ce;
    --bn-teal-light: #eaf8f9;
    --bn-teal-dark: #163f44;
    --bn-teal-accent: #36cee2;

    /* Page Structure */
    --page-bg: #1C1D1F;
    --page-text: #d2dbde;
    --page-text-secondary: #859399;
    --border-color: #38393b;

    /* Sidebar */
    --sidebar-bg: #252628;
    --sidebar-text: #d2dbde;

    /* Code/Fragments */
    --code-bg: #2a2c2f;
    --code-text: #d2dbde;
    --fragment-bg: #282c34;
    --fragment-text: #dbe4eb;
    --fragment-border: #1f1f1f;

    /* Syntax Highlighting (Dark) */
    --syntax-keyword: #cc99cd;
    --syntax-type: #ab99cd;
    --syntax-flow: #e08000;
    --syntax-string: #7ec699;
    --syntax-comment: #999999;
    --syntax-preprocessor: #65cabe;
    --syntax-link: #98c0e3;

    /* Tables */
    --table-header-bg: #2a2c2f;
    --table-row-odd: #1C1D1F;
    --table-row-even: #252628;

    /* Content Boxes */
    --warning-bg: #3b2e04;
    --warning-border: #f1b602;
    --note-bg: var(--bn-teal-dark);
    --note-border: var(--bn-teal-accent);
    --deprecated-bg: #2e323b;
    --deprecated-border: #738396;
    --bug-bg: #2e1917;
    --bug-border: #ad2617;
    --todo-bg: #2a2536;
    --todo-border: #7661b3;
}

/* Respect system color preference */
@media (prefers-color-scheme: dark) {
    html:not(.light-mode) {
        color-scheme: dark;

        --bn-red: #c74433;
        --bn-red-dark: #d0584d;
        --bn-red-light: #a2382a;

        --bn-teal: #33b6c7;
        --bn-teal-bright: #16b9ce;
        --bn-teal-light: #eaf8f9;
        --bn-teal-dark: #163f44;
        --bn-teal-accent: #36cee2;

        --page-bg: #1C1D1F;
        --page-text: #d2dbde;
        --page-text-secondary: #859399;
        --border-color: #38393b;

        --sidebar-bg: #252628;
        --sidebar-text: #d2dbde;

        --code-bg: #2a2c2f;
        --code-text: #d2dbde;
        --fragment-bg: #282c34;
        --fragment-text: #dbe4eb;
        --fragment-border: #1f1f1f;

        --syntax-keyword: #cc99cd;
        --syntax-type: #ab99cd;
        --syntax-flow: #e08000;
        --syntax-string: #7ec699;
        --syntax-comment: #999999;
        --syntax-preprocessor: #65cabe;
        --syntax-link: #98c0e3;

        --table-header-bg: #2a2c2f;
        --table-row-odd: #1C1D1F;
        --table-row-even: #252628;

        --warning-bg: #3b2e04;
        --warning-border: #f1b602;
        --note-bg: var(--bn-teal-dark);
        --note-border: var(--bn-teal-accent);
        --deprecated-bg: #2e323b;
        --deprecated-border: #738396;
        --bug-bg: #2e1917;
        --bug-border: #ad2617;
        --todo-bg: #2a2536;
        --todo-border: #7661b3;
    }
}

/* ============================================================================
 * BASE STYLES
 * ============================================================================ */
* {
    box-sizing: border-box;
}

html {
    font-size: var(--font-size-base);
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--page-text);
    background-color: var(--page-bg);
}

/* ============================================================================
 * TYPOGRAPHY
 * ============================================================================ */
h1, h2, h3, h4, h5, h6 {
    margin: 1em 0 0.5em 0;
    font-weight: 600;
    line-height: 1.3;
    color: var(--page-text);
}

h1 { font-size: 2em; }
h2 { font-size: 1.5em; }
h3 { font-size: 1.25em; }
h4 { font-size: 1.1em; }
h5, h6 { font-size: 1em; }

p, div, table, dl {
    font-size: var(--font-size-base);
    line-height: var(--line-height-content);
}

a {
    color: var(--bn-red);
    text-decoration: none;
    font-weight: 500;
}

a:hover {
    text-decoration: underline;
}

code, tt {
    font-family: var(--font-family-monospace);
    font-size: var(--font-size-code);
    background-color: var(--code-bg);
    color: var(--code-text);
    padding: 2px 6px;
    border-radius: var(--border-radius-small);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ============================================================================
 * HEADER AND TOP NAVIGATION
 * ============================================================================ */
#top {
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 99;
    height: var(--top-height);
    max-width: var(--sidebar-width);
    overflow: hidden;
}

#titlearea {
    width: auto;
    padding: var(--spacing-medium) var(--spacing-large);
    background: var(--sidebar-bg);
    color: var(--page-text);
    border-bottom: none;
    position: relative;
}

#titlearea table {
    background: transparent;
}

#titlearea table tbody tr {
    height: auto;
    background: transparent;
}

#titlearea table tbody tr td {
    background: transparent;
}

#projectalign {
    padding-left: var(--spacing-medium);
}

#projectname {
    font-size: var(--font-size-title);
    font-weight: 600;
    white-space: nowrap;
}

#projectname a {
    color: var(--page-text);
}

#projectnumber {
    font-family: inherit;
    font-size: 60%;
    color: var(--page-text-secondary);
}

#projectlogo img {
    max-height: calc(var(--font-size-title) * 2);
}

tr#projectrow {
    margin-top: 7px;
    display: block;
}

/* ============================================================================
 * SIDEBAR LAYOUT (Desktop)
 * ============================================================================ */
#side-nav {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    top: var(--top-height);
    position: fixed;
    left: 0;
    bottom: 0;
    overflow: visible;
    background: var(--sidebar-bg);
}

#nav-tree, #side-nav {
    height: calc(100vh - var(--top-height));
}

#top {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    border-bottom: none;
    margin-bottom: calc(0px - var(--top-height));
    background: var(--sidebar-bg);
}

#main-nav {
    float: left;
    padding-right: 0;
}

.ui-resizable-handle {
    display: none;
}

.ui-resizable-e {
    width: 0;
}

#nav-path {
    position: fixed;
    right: 0;
    left: calc(var(--sidebar-width) + 1px);
    bottom: 0;
    width: auto;
    background: var(--page-bg);
    border-top: 1px solid var(--border-color);
}

#container {
    min-height: 100vh;
    background-color: var(--page-bg);
}

#doc-content {
    min-height: calc(100vh - 31px);
    padding-bottom: calc(3 * var(--spacing-large));
    padding-top: calc(var(--top-height) - 80px);
    padding-left: var(--spacing-large);
    padding-right: var(--spacing-large);
    box-sizing: border-box;
    background-color: var(--page-bg);
}

#MSearchBox {
    width: calc(var(--sidebar-width) - calc(2 * var(--spacing-medium)) - 50px);
    display: inline-block;
    vertical-align: top;
}

#MSearchField {
    width: calc(var(--sidebar-width) - calc(2 * var(--spacing-medium)) - 113px);
    padding-left: 10px;
    top: -1px;
}

#MSearchResultsWindow {
    left: var(--spacing-medium);
    right: auto;
}

#nav-sync {
    display: none;
}

#splitbar {
    display: none;
}

/* ============================================================================
 * RESPONSIVE (Tablet and Mobile)
 * ============================================================================ */

/* Tablet: Hide sidebar, adjust margins */
@media screen and (max-width: 1024px) {
    #side-nav {
        display: none;
    }

    .sidebar-toggle {
        display: none;
    }

    #top {
        position: relative;
        width: 100%;
        max-width: none;
        border-right: none;
    }

    #container {
        margin-left: 0;
        min-height: 100vh;
    }

    #doc-content {
        margin-left: 0;
        padding-top: var(--spacing-large);
        min-height: calc(100vh - var(--spacing-large));
    }

    #nav-path {
        position: relative;
        left: 0;
        right: 0;
        width: 100%;
    }
}

/* Mobile: Compact layout */
@media screen and (max-width: 767px) {
    #top {
        height: 125px;
    }

    #doc-content {
        padding-top: 125px;
        padding-left: var(--spacing-medium);
        padding-right: var(--spacing-medium);
    }

    div.contents {
        padding: 0 var(--spacing-small);
    }

    #MSearchBox {
        top: -16px;
    }
}

/* Small mobile: Even more compact */
@media screen and (max-width: 480px) {
    #titlearea {
        padding: var(--spacing-small);
    }

    div.contents {
        padding: 0;
    }

    #doc-content {
        padding-left: var(--spacing-small);
        padding-right: var(--spacing-small);
    }
}

/* ============================================================================
 * SEARCH BAR
 * ============================================================================ */
#titlearea #projectalign + td {
    position: absolute;
    left: 20px;
    top: 80px;
}

#MSearchBox {
    height: var(--searchbar-height);
    background: var(--sidebar-bg);
    border-radius: var(--searchbar-border-radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
    box-shadow: none;
    display: inline-block;
    margin-top: 0;
}

#MSearchBox.MSearchBoxActive {
    border-color: var(--bn-red);
    box-shadow: inset 0 0 0 1px var(--bn-red);
}

#MSearchBox span.left {
    left: 5px;
    top: 1px;
    background: none;
    background-image: none;
}

#MSearchBox span.right {
    padding-top: calc(calc(var(--searchbar-height) / 2) - 12px);
    position: absolute;
    right: var(--spacing-small);
    background: none;
    background-image: none;
}

#MSearchField {
    font-size: var(--font-size-nav);
    font-family: var(--font-family);
    height: calc(var(--searchbar-height) - 2px);
    background: transparent;
    border: none;
    color: var(--page-text);
}

.MSearchBoxActive #MSearchField {
    color: var(--page-text);
}

#MSearchSelect {
    top: calc(calc(var(--searchbar-height) / 2) - 11px);
    background-repeat: no-repeat;
}

#MSearchSelectWindow, #MSearchResultsWindow {
    z-index: 9999;
    background-color: var(--page-bg);
    border: 1px solid var(--border-color);
}

/* ============================================================================
 * NAVIGATION TREE
 * ============================================================================ */
#side-nav {
    background-color: var(--sidebar-bg);
}

#nav-tree {
    background-color: var(--sidebar-bg);
    overflow-x: auto;
    overflow-y: auto;
}

#nav-tree .label {
    font-size: var(--font-size-nav);
    color: var(--sidebar-text);
}

#nav-tree a {
    color: var(--sidebar-text);
    text-decoration: none;
}

#nav-tree a:hover {
    text-decoration: underline;
}

#nav-tree .arrow {
    opacity: 0.6;
    transition: opacity 0.2s;
    display: inline-block;
    min-width: 32px;
    text-align: center;
    box-sizing: border-box;
}

#nav-tree .item:hover .arrow {
    opacity: 1;
}

#nav-tree .selected {
    background-color: var(--bn-red);
    color: #ffffff;
    display: inline-block;
    line-height: 1.4;
    padding: 0 4px;
    margin: 0 -4px;
}

#nav-tree .selected a {
    color: #ffffff;
}

html.dark-mode #nav-tree .selected {
    background-color: var(--bn-red);
    color: #ffffff;
}

html.dark-mode #nav-tree .selected a {
    color: #ffffff;
}

#nav-tree .item {
    min-height: var(--tree-item-height);
    line-height: 1.4;
    padding-top: 6px;
    padding-bottom: 6px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

/* Undecorated root node */
.children_ul a.index\.html {
    display: initial;
}

a.index\.html {
    display: none;
}

/* Doxygen 1.15 creates a wrapper node - hide it but show its children */
#nav-tree-contents > ul > li:first-child > .item {
    display: none !important;
}

/* Make the wrapper's children appear at the top level by removing their indentation */
#nav-tree-contents > ul > li:first-child > ul {
    padding-left: 0 !important;
    margin-left: 0 !important;
}

/* No compensation needed - arrows are now consistent */
#nav-tree-contents > ul > li:first-child > ul > li > .item {
    margin-left: 0;
}

/* Add spacing between top-level items */
#nav-tree-contents > ul > li:first-child > ul > li {
    margin-top: 2px;
}

#nav-tree-contents > ul > li:first-child > ul > li:first-child {
    margin-top: 0;
}

/* ============================================================================
 * COLLAPSIBLE SECTIONS (dynsections.js)
 * ============================================================================ */
.arrowhead {
    display: inline-block;
    margin-right: 5px;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 11px;
    line-height: 1;
    color: var(--text-color);
}

.arrow:hover .arrowhead,
tr:hover .arrowhead,
.arrowhead.opened {
    opacity: 1;
}

/* Right-pointing triangle when closed */
.arrowhead.closed::before {
    content: '▶';
}

/* Down-pointing triangle when opened */
.arrowhead.opened::before {
    content: '▼';
}

/* ============================================================================
 * CONTENT AREA
 * ============================================================================ */
div.contents, div.header .title, div.header .summary {
    max-width: 100%;
}

div.contents, div.header .title {
    line-height: initial;
    margin: calc(var(--spacing-medium) + .2em) 0 var(--spacing-medium) 0;
}

div.header .summary {
    margin: var(--spacing-medium) 0 0 0;
}

div.headertitle {
    padding: 0;
    border-bottom: 0;
    background-color: var(--page-bg);
}

div.headertitle .title {
    font-size: 2em;
    font-weight: 600;
    margin: var(--spacing-large) 0;
}

div.contents {
    padding: 0 var(--spacing-xlarge);
}

div.contents p, div.contents li {
    line-height: var(--line-height-content);
}

div.contents div.dyncontent {
    margin: var(--spacing-medium) 0;
}

@media screen and (max-width: 767px) {
    div.contents {
        padding: 0 var(--spacing-large);
    }

    div.header .title {
        padding: var(--spacing-medium) var(--spacing-large);
    }
}

.contents img, .contents .center, .contents center, .contents div.image object {
    max-width: 100%;
    overflow: auto;
}

.contents hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: var(--spacing-large) 0;
}

/* ============================================================================
 * TABLES
 * ============================================================================ */
/* Only apply to content tables, not Doxygen structural tables */
div.contents > table:not(.memberdecls):not(.mlabels):not(.memname):not(.params),
div.contents p + table,
div.textblock table:not(.memname):not(.params) {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
    word-wrap: break-word;
}

/* Content tables (HTML tables in documentation) */
div.contents > table,
div.contents p + table,
div.textblock table {
    margin: var(--spacing-medium) 0;
    border: 1px solid var(--border-color);
}

div.contents > table th,
div.contents p + table th,
div.textblock table th {
    background-color: var(--table-header-bg);
    color: var(--page-text);
    padding: var(--spacing-small) var(--spacing-medium);
    text-align: left;
    border: 1px solid var(--border-color);
    font-weight: 600;
}

div.contents > table td,
div.contents p + table td,
div.textblock table td {
    padding: var(--spacing-small) var(--spacing-medium);
    border: 1px solid var(--border-color);
    vertical-align: top;
}

div.contents > table tr:nth-child(odd),
div.contents p + table tr:nth-child(odd),
div.textblock table tr:nth-child(odd) {
    background-color: var(--page-bg);
}

div.contents > table tr:nth-child(even),
div.contents p + table tr:nth-child(even),
div.textblock table tr:nth-child(even) {
    background-color: var(--table-row-even);
}

table.memberdecls {
    width: 100%;
}

table.memberdecls .memItemLeft {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding: var(--spacing-small) var(--spacing-medium);
    border-bottom: 1px solid var(--border-color);
    width: 40%;
}

table.memberdecls .memItemRight {
    padding: var(--spacing-small) var(--spacing-medium);
    border-bottom: 1px solid var(--border-color);
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 60%;
}

table.memberdecls td {
    vertical-align: top;
}

/* Markdown tables */
table.markdownTable {
    border-collapse: collapse;
    width: 100%;
    margin: var(--spacing-medium) 0;
    border: 1px solid var(--border-color);
}

table.markdownTable th {
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: var(--spacing-small) var(--spacing-medium);
    text-align: left;
    border: 1px solid var(--border-color);
    font-weight: 600;
}

table.markdownTable td {
    padding: var(--spacing-small) var(--spacing-medium);
    border: 1px solid var(--border-color);
    vertical-align: top;
}

table.markdownTable tr.markdownTableRowOdd {
    background-color: var(--fragment-bg);
}

table.markdownTable tr.markdownTableRowEven {
    background-color: var(--page-bg);
}

/* Directory table (class list) */
.directory {
    margin: var(--spacing-medium) 0;
}

.directory .levels {
    font-size: 0.75em;
    text-align: right;
    margin-bottom: var(--spacing-small);
    color: var(--page-text-secondary);
}

.directory .levels span {
    cursor: pointer;
    margin-left: var(--spacing-small);
}

.directory .levels span:hover {
    color: var(--page-text);
}

/* Make the numbers much dimmer */
.directory .levels span[onclick] {
    opacity: 0.4;
}

.directory .levels span[onclick]:hover {
    opacity: 0.7;
}

table.directory {
    width: 100%;
    border-collapse: collapse;
}

table.directory tr.even {
    background-color: var(--table-row-even);
}

table.directory tr.odd {
    background-color: var(--table-row-odd);
}

table.directory td {
    padding: var(--spacing-small) var(--spacing-medium);
    border-bottom: 1px solid var(--border-color);
}

table.directory td.entry {
    vertical-align: middle;
}

table.directory td.desc {
    vertical-align: middle;
    color: var(--page-text-secondary);
}

/* Detail level labels (default, inline, virtual, etc.) */
table.mlabels {
    border-spacing: 0;
    width: 100%;
}

table.mlabels td.mlabels-left {
    width: 100%;
}

table.mlabels td.mlabels-right {
    vertical-align: bottom;
}

span.mlabel {
    background: var(--bn-red);
    color: #ffffff;
    margin-left: 2px;
    padding: 2px 5px;
    border-radius: 6px;
    font-size: 9pt;
    white-space: nowrap;
    font-weight: 600;
}

/* Function signature tables */
table.memname {
    border-collapse: collapse;
}

div.memproto table.memname {
    font-family: var(--font-family-monospace);
    color: var(--code-text);
}

.memname td {
    vertical-align: bottom;
}


/* Type/Namespace icons (C, N, S, etc.) */
.icon {
    display: inline-block;
    background-color: var(--bn-red);
    color: #ffffff;
    font-family: var(--font-family-monospace);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 5px 2px 5px;
    margin-right: 6px;
    border-radius: 3px;
    text-align: center;
    min-width: 16px;
    line-height: 1.2;
    vertical-align: middle;
}

table thead th {
    background-color: var(--table-header-bg);
    color: var(--page-text);
    font-weight: 600;
    padding: var(--spacing-small) var(--spacing-medium);
    border-bottom: 1px solid var(--border-color);
}

/* ============================================================================
 * CODE BLOCKS AND FRAGMENTS
 * ============================================================================ */
pre.fragment, div.fragment {
    font-family: var(--font-family-monospace);
    font-size: var(--font-size-code);
    background-color: var(--fragment-bg);
    color: var(--fragment-text);
    border-radius: var(--border-radius-small);
    padding: var(--spacing-medium);
    overflow-x: auto;
    overflow-y: auto;
    border: 1px solid var(--fragment-border);
    max-width: 100%;
}

.line {
    line-height: 20px;
    font-family: var(--font-family-monospace);
}

.lineno {
    color: #797979;
    background-color: #f4f4f5;
    border-right: 1px solid var(--fragment-border);
    padding-right: 8px;
    padding-left: 8px;
    margin-right: 8px;
}

html.dark-mode .lineno {
    color: #cccccc;
    background-color: #35393c;
}

/* Syntax highlighting */
span.keyword { color: var(--syntax-keyword); }
span.keywordtype { color: var(--syntax-type); }
span.keywordflow { color: var(--syntax-flow); }
span.stringliteral { color: var(--syntax-string); }
span.comment { color: var(--syntax-comment); }
span.preprocessor { color: var(--syntax-preprocessor); }
span.lineno a { color: var(--syntax-comment); }

/* ============================================================================
 * CONTENT BOXES (@note, @warning, etc.)
 * ============================================================================ */
dl.warning, dl.attention {
    background-color: var(--warning-bg);
    border-left: 4px solid var(--warning-border);
    padding: var(--spacing-medium);
    border-radius: var(--border-radius-small);
    margin: var(--spacing-medium) 0;
}

dl.note {
    background-color: var(--note-bg);
    border-left: 4px solid var(--note-border);
    padding: var(--spacing-medium);
    border-radius: var(--border-radius-small);
    margin: var(--spacing-medium) 0;
}

dl.todo {
    background-color: var(--todo-bg);
    border-left: 4px solid var(--todo-border);
    padding: var(--spacing-medium);
    border-radius: var(--border-radius-small);
    margin: var(--spacing-medium) 0;
}

dl.deprecated {
    background-color: var(--deprecated-bg);
    border-left: 4px solid var(--deprecated-border);
    padding: var(--spacing-medium);
    border-radius: var(--border-radius-small);
    margin: var(--spacing-medium) 0;
}

dl.bug {
    background-color: var(--bug-bg);
    border-left: 4px solid var(--bug-border);
    padding: var(--spacing-medium);
    border-radius: var(--border-radius-small);
    margin: var(--spacing-medium) 0;
}

/* ============================================================================
 * MEMBER DOCUMENTATION
 * ============================================================================ */
.memitem {
    margin-bottom: var(--spacing-large);
    position: relative;
}

.memtitle {
    background-color: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small) var(--border-radius-small) 0 0;
    padding: var(--spacing-small) var(--spacing-medium);
    font-size: 18px;
    font-weight: 600;
    font-family: var(--font-family-monospace);
}

.memname {
    font-family: var(--font-family-monospace);
}

.memdoc {
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--border-radius-small) var(--border-radius-small);
    padding: var(--spacing-medium);
    background-color: var(--page-bg);
}

.memproto {
    background-color: var(--fragment-bg);
    border: 1px solid var(--border-color);
    padding: var(--spacing-small) var(--spacing-medium);
    border-radius: var(--border-radius-small);
}

.paramname em,
.paramname span.paramname {
    color: var(--bn-red-light);
    font-style: italic;
}

.paramtype .el {
    color: var(--bn-red-dark);
}

/* ============================================================================
 * THREAD SAFETY BADGES (Binary Ninja specific)
 * ============================================================================ */
dl.threadsafe {
    position: absolute;
    top: 0px;
    right: 8px;
    margin-top: 5px;
    background-color: var(--code-bg);
    font-weight: normal;
    padding: 2px 4px 2px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

html.dark-mode dl.threadsafe {
    background-color: var(--code-bg);
}

.threadsafe dt {
    padding-right: 40px;
    color: var(--page-text);
}

.threadsafe.Main.Thread.Only dt {
    padding-right: 155px;
}

.threadsafe.Yes dd {
    display: inline;
    margin-inline-start: 0;
    position: absolute;
    top: 0px;
    right: 0px;
    padding: 3px 8px;
    background-color: #6b9d63;
    color: #ffffff;
    border-bottom-right-radius: 3px;
    border-top-right-radius: 3px;
    min-width: 28px;
    text-align: center;
    font-weight: 600;
}

html.dark-mode .threadsafe.Yes dd {
    background-color: #5a7a54;
    color: #e8f5e6;
}

.threadsafe.No dd {
    display: inline;
    margin-inline-start: 0;
    position: absolute;
    top: 0px;
    right: 0px;
    padding: 3px 8px;
    background-color: #c76058;
    color: #ffffff;
    border-bottom-right-radius: 3px;
    border-top-right-radius: 3px;
    min-width: 28px;
    text-align: center;
    font-weight: 600;
}

html.dark-mode .threadsafe.No dd {
    background-color: #9d5048;
    color: #fce8e6;
}

.threadsafe.Main.Thread.Only dd {
    display: inline;
    margin-inline-start: 0;
    position: absolute;
    top: 0px;
    right: 0px;
    padding: 3px 8px;
    background-color: #c76058;
    color: #ffffff;
    border-bottom-right-radius: 3px;
    border-top-right-radius: 3px;
    min-width: 145px;
    text-align: center;
    font-weight: 600;
}

html.dark-mode .threadsafe.Main.Thread.Only dd {
    background-color: #9d5048;
    color: #fce8e6;
}

img.thread {
    max-width: 15px;
    position: relative;
    top: 2px;
    padding-right: 3px;
}

html.dark-mode img.thread {
    filter: invert(0.7);
}

/* ============================================================================
 * BINARY NINJA CUSTOMIZATIONS
 * ============================================================================ */

/* External link icon */
div.contents a[href^="http"]:after {
    content: " " url();
}

/* GitHub logo */
.githublogo {
    content: url();
}

/* Group headers */
td h2.groupheader, h2.groupheader {
    border-bottom: 0px;
    color: var(--page-text);
    background: var(--page-bg);
    font-weight: 600;
    margin-top: var(--spacing-large);
}

/* Table of Contents - Disabled */
div.contents .toc {
    display: none;
}

div.toc {
    display: none;
}

/* ============================================================================
 * SCROLLBAR STYLING
 * ============================================================================ */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: var(--border-radius-small);
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--page-text-secondary);
}

#nav-tree::-webkit-scrollbar-thumb,
div.fragment::-webkit-scrollbar-thumb,
pre.fragment::-webkit-scrollbar-thumb {
    background-color: transparent;
    border: 4px solid transparent;
    border-radius: 12px;
    background-clip: padding-box;
}

#nav-tree:hover::-webkit-scrollbar-thumb,
div.fragment:hover::-webkit-scrollbar-thumb,
pre.fragment:hover::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
}

#nav-tree::-webkit-scrollbar-corner {
    background-color: var(--sidebar-bg);
}

/* Firefox scrollbar */
#nav-tree,
div.fragment,
pre.fragment {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* ============================================================================
 * DARK MODE TOGGLE
 * ============================================================================ */
.bn-darkmode-toggle {
    display: inline-block;
    width: 33px;
    height: var(--searchbar-height);
    border: 1px solid var(--border-color);
    background-color: var(--page-bg);
    color: var(--page-text);
    cursor: pointer;
    font-size: 16px;
    line-height: var(--searchbar-height);
    border-radius: var(--searchbar-border-radius);
    vertical-align: top;
    margin-left: 5px;
    margin-right: 3px;
    text-align: center;
    padding: 0;
}

.bn-darkmode-toggle:hover {
    background-color: var(--table-header-bg);
    border-color: var(--bn-red);
}

@media screen and (max-width: 1024px) {
    .bn-darkmode-toggle {
        display: none;
    }
}

/* ============================================================================
 * IMAGE HANDLING IN DARK MODE
 * ============================================================================ */
html.dark-mode div.contents div.dyncontent img,
html.dark-mode div.contents center img,
html.dark-mode div.contents > table img {
    filter: brightness(89%) hue-rotate(180deg) invert();
}

html.dark-mode .darkmode_inverted_image img,
html.dark-mode .darkmode_inverted_image object[type="image/svg+xml"] {
    filter: brightness(89%) hue-rotate(180deg) invert();
}

/* ============================================================================
 * SIDEBAR COLLAPSE
 * ============================================================================ */

.sidebar-toggle {
    position: fixed;
    bottom: 20px;
    left: calc(var(--sidebar-width) - 50px);
    z-index: 1000;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-color);
    background-color: var(--page-bg);
    color: var(--page-text);
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background-color: var(--table-header-bg);
    border-color: var(--link-color);
}

/* Collapsed sidebar state */
#side-nav.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    overflow: visible !important;
}

#side-nav.collapsed .sidebar-toggle {
    left: 10px;
}

/* Hide header/top when collapsed */
#top.collapsed,
#titlearea.collapsed {
    display: none !important;
}

#doc-content.sidebar-collapsed,
#container.sidebar-collapsed {
    margin-left: 0 !important;
}

#doc-content.sidebar-collapsed {
    width: 100% !important;
}

.ui-resizable-handle {
    transition: left 0.3s ease;
}

#side-nav.collapsed ~ #splitbar {
    left: 0 !important;
    display: none;
}
